﻿using FluentNHibernate.Mapping;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YYSite.Domain;
using YYSite.Domain.Content.Articles;

namespace YYSite.Repository.Content.Articles
{
    public class ArticleMap:ClassMap<Article>
    {
        public ArticleMap()
        {
            this.Table("Article");
            this.Schema("Content");
            this.Id(p => p.Id);
            this.Map(p => p.Title).Not.Nullable().Length(256);
            this.Map(p => p.BehalfImage).Nullable().Length(256);
            this.Map(p => p.ContentHTML).Nullable().Length(8000);
            this.Map(p => p.ContentText).Nullable().Length(4000);
            this.Map(p => p.ContentImage).Nullable().Length(4000);
            this.Map(p => p.Author).Nullable().Length(256);
            this.Map(p => p.Status);
            this.Map(p => p.Hits);
            this.Map(p => p.Hot);
            this.Map(p => p.Sequence);
            this.Map(p => p.TopCount);
            this.Map(p => p.DownCount);
            this.Map(p => p.CreateTime).Default("GETDATE()");
        }
    }
}
